package com.beiding.component;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

@Component
public class MyRabbitTemplate extends MyRabbitTemplateInterlayer implements MyRabbitOperations {

    public MyRabbitTemplate(RabbitTemplate rabbitTemplate) {
        super(rabbitTemplate);
    }

    @Override
    public void send(String routingKey, long expiration, Object message) {
        rabbitTemplate.convertAndSend(routingKey, message, (m -> {
            m.getMessageProperties().setExpiration(Long.toString(expiration));
            return m;
        }));
    }


}
